<template>
	<view v-show="info">
		<view class="topbak" :style="{ height: sH +10+ 'px' }">

		</view>
		<image src="@/static/r.png" mode="widthFix" style="width: 40rpx;margin-left: 32rpx;" @click="back"></image>
		<view class="bag">
			<view class="mc">
				申诉中，请如实填写
			</view>
			<view class="botinfo">
				<!-- 已完成 -->
				<view class="infok">
				
					<view class="qu flex items-center">
						<view class="q_o  flex-center">
							车
						</view>
						<view class="q_w    ">
							{{info.vehicle.trailer_address}}
						</view>
					</view>
					<view class="qu flex items-center">
						<view class="q_o_w flex-center">
							目
						</view>
						<view class="q_w    ">
							{{info.Destination.user_location}}
						</view>
					</view>
					<view class="info flex items-start">
						<view class="o" style="opacity: 0;">
							1.3km
						</view>
						<view class="t">
							{{info.Destination.consignee}}
						</view>
						<view class="h">
							{{info.Destination.mobile}}
						</view>
						<view class="f flex-center" v-show="curNow==2">
							上门安装
						</view>
					</view>
					<view class="" style="color: #666B75;font-size: 28rpx; text-align: right;margin-top: 24rpx;">
						<view class="" v-show="i.rider_status==4">
							佣金<span style="color: #FF6401;font-weight: bold;">￥{{i.actual_price}}</span>
						</view>
						<view class="" style="font-weight: bold;font-size: 28rpx;color: #FF6401;" v-show="i.rider_status==5">
							用户取消订单
						</view>
						<view class="" style="font-weight: bold;font-size: 28rpx;color: #FF6401;" v-show="i.rider_status==6">
							用户取消订单，订单申诉中
						</view>
					</view>
				</view>
				<!-- 拖车  已完成 -->
				<!-- <view class="infok" v-show="active==2&&(curNow==0||curNow==1||curNow==3)">
					<view class="title flex justify-between">
						<view class="" style="font-weight: bold;font-size: 28rpx;color: #3377FF;">
							已完成
						</view>
						<view class="" style="font-size: 28rpx;color: #CCCED1;">
							2022-02-12 14:30
						</view>
					</view>
					<view class="qu flex items-center">
						<view class="q_o  flex-center">
							{{curNow==2?'取':curNow==3?'锁':curNow==1?'服':'车'}}
						</view>
						<view class="q_w    ">
							超威电池专卖店(青山路店)
						</view>
					</view>
					<view class="qu flex items-center">
						<view class="q_o_w flex-center">
							{{curNow==2?'收':'目'}}
						</view>
						<view class="q_w    ">
							贵阳市南明区花果园金融街1号1824
						</view>
					</view>
					<view class="info flex items-start">
						<view class="o" style="opacity: 0;">
							1.3km
						</view>
						<view class="t">
							王先生
						</view>
						<view class="h">
							156****5412
						</view>
						<view class="f flex-center" v-show="curNow==2">
							上门安装
						</view>
					</view>
					<view class="" style="color: #666B75;font-size: 28rpx; text-align: right;margin-top: 24rpx;">
						<view class="" v-show="index==0">
							佣金<span style="color: #FF6401;">￥2500.05</span>
						</view>
						<view class="" style="font-weight: bold;font-size: 28rpx;color: #FF6401;" v-show="index==1">
							用户取消订单
						</view>
						<view class="" style="font-weight: bold;font-size: 28rpx;color: #FF6401;" v-show="index==2">
							用户取消订单，订单申诉中
						</view>
					</view>
				</view> -->
				<view class="gzinfo">
					<view class=" flex justify-between items-center" @click="show = true">
						<view class="gz_o f2">
							申诉原因
						</view>
						<view class="f7">
							<input type="text" v-model="ssyy.title" placeholder="请选择申诉原因" disabled="true" />
						</view>
						<view class="gz_t f1 flex justify-end">
							<image src="@/static/r2.png" mode="widthFix" style="width: 32rpx;"></image>
						</view>
					</view>
				</view>
				<view class="xcimg">
					<view class="title">
						现场照片
					</view>
					<view class="ms" style="font-size: 28rpx;color: #00091A;margin-top: 32rpx;">
						<textarea value="" v-model="ms" placeholder="在这里输入您的描述" />
					</view>
					<view class="imglist flex justify-start flex-wrap" @click="openChooseImg">
						<image :src="img" mode="widthFix" class="zwt" v-if="img"></image>
						<image src="@/static/up.png" mode="widthFix" class="zwt" v-else></image>
					</view>
				</view>
			</view>
			<view class="butgp flex" @click="unlocking_complaint_from_the_order_taker">
				<view class="t_jd flex-center">
					确认申诉
				</view>
			</view>
			<image src="@/static/logo.png" mode="widthFix" class="botbg">
		</view>
		<u-picker :show="show" :columns="infoy" @cancel="show=false" @confirm="confirm" keyName="title"
			@change="changeHandler"></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curNow: 0,
				active: 0,
				sH: '',
				ssyy:'',
				type: '',
				img:'',
				show: false,
				ms:'',
				columns: [
					['中国', '美国', '日本']
				],
				id: '',
				info:'',
				myla: '',
				mylo: '',
				infoy:''
			};
		},
		onLoad(o) {
			this.getWinTop().then(res => {
				this.sH = res.statusBar;
			});
			console.log(o);
			this.curNow = o.curNow
			this.active = o.active
			this.type = o.type
			
			let v=JSON.parse(o.id)
			this.id = v.id
			this.cshLo()
			this.appeal_list()
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			unlocking_complaint_from_the_order_taker(){
				this.$api.unlocking_complaint_from_the_order_taker({
					order_id:this.id,
					reason_for_appeal:this.ssyy.id,
					statement_description:this.ms,
					picture_of_appeal:this.img
				}).then(res => {
					uni.showToast({
						icon:'none',
						title:'申诉成功'
					})
					uni.navigateBack()
				});
			
			},
			appeal_list(){
				this.$api.appeal_list({
				}).then(res => {
				  const convertToColumns = (array) => {
				    return [array.map(item => item)];
				  };
				  this.infoy = convertToColumns(res.data);
				  console.log(this.infoy);
				});

			},
			cshLo() {
				let app = this
				uni.getLocation({
					type: 'wgs84',
					success: function(res) {
						console.log('当前位置的经度：' + res.longitude);
						app.myla = res.latitude
						app.mylo = res.longitude
						console.log('当前位置的纬度：' + res.latitude);
						app.unlocking_order()
					},
					fail(err) {
						console.log(err, 'err');
					}
				});
			},
			unlocking_order() {
				console.log('aaa');
				this.$api.unlocking_order({
					order_id: this.id,
					lat: this.myla,
					lng: this.mylo
				}).then(res => {
					this.info = res.data
					console.log(this.info);
				})
			},
			openChooseImg() {
				console.log('aa');
				uni.chooseImage({
					count: 1, //最多可选择的张数
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择，和摄像头功能，默认二者都有
					success: res => {
						console.log(res, '头像res')
						this.img = res.tempFilePaths[0] //把选择的头像赋值给img
						console.log(this.img, 'this.img')
						this.$http.uploadFile(this.img).then(res => {
							// this.form.images.push(res);
							console.log('aaa', res.url);
							this.img = res.fullurl
						}).finally(() => {
							this.$msg.hideLoading();
						});
					},fail(res) {
						console.log(res);
					}
				});
			},
			
			changeHandler(e) {
				const {
					columnIndex,
					value,
					values, // values为当前变化列的数组内容
					index,
					// 微信小程序无法将picker实例传出来，只能通过ref操作
					picker = this.$refs.uPicker
				} = e
				// 当第一列值发生变化时，变化第二列(后一列)对应的选项
				if (columnIndex === 0) {
					// picker为选择器this实例，变化第二列对应的选项
					picker.setColumnValues(1, this.columnData[index])
				}
			},
			// 回调参数为包含columnIndex、value、values
			confirm(e) {
				console.log('confirm', e)
				this.ssyy=e.value[0]
				this.show = false
			}


		},

	}
</script>

<style lang="scss">
	::v-deep .amap-logo {
		opacity: 0 !important;
	}

	::v-deep .amap-copyright {
		opacity: 0 !important;
	}

	.botbg2 {
		position: absolute;
		bottom: 30px;
		width: 750rpx;
	}

	.bag {
		position: relative;

		.mc {
			margin: 24rpx 32rpx;
			font-weight: bold;
			font-size: 40rpx;
			color: #00091A;
		}

		.botinfo {
			padding-bottom: 100rpx;

			.infok {
				margin: 0 auto;
				z-index: 1;
				padding: 24rpx;
				width: 686rpx;
				// height: 436rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
				border-radius: 24rpx 24rpx 24rpx 24rpx;

				.title {
					.t_o {
						font-weight: bold;
						font-size: 36rpx;
						color: #FF6401;

						.ji {
							color: #FFFFFF;
							font-size: 24rpx;
							width: 40rpx;
							height: 40rpx;
							background: #FF6401;
							border-radius: 8rpx 8rpx 8rpx 8rpx;
						}
					}

					.t_w {
						font-weight: bold;
						font-size: 28rpx;
						color: #3377FF;
					}
				}

				.qu {
					margin-top: 30rpx;
					padding-left: 10rpx;

					.q_o {
						width: 40rpx;
						height: 40rpx;
						background: #F7FAFF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #3377FF;
					}

					.q_o_o {
						width: 40rpx;
						height: 40rpx;
						background: #3377FF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #FFFFFF;
					}

					.q_o_b {
						width: 40rpx;
						height: 40rpx;
						background: #F7FAFF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #3377FF;
					}

					.q_o_w {
						width: 40rpx;
						height: 40rpx;
						background: #F7FAFF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #3377FF;
					}

					.q_w {
						padding-left: 42rpx;
						font-weight: bold;
						font-size: 32rpx;
						color: #00091A;
						width: 558rpx;
					}

					.q_o_t {
						width: 40rpx;
						height: 40rpx;
						background: #3377FF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #FFFFFF;
					}

					.q_o_d {
						width: 40rpx;
						height: 40rpx;
						background: #F7FAFF;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-size: 20rpx;
						color: #3377FF;
					}
				}

				.info {
					margin-top: 15rpx;

					.o {
						font-size: 20rpx;
						color: #999CA3;
					}

					.t {
						font-weight: bold;
						margin-left: 35rpx;
						font-size: 28rpx;
						color: #333A47;
					}

					.h {
						margin-left: 35rpx;
						font-size: 28rpx;
						color: #999CA3;
					}

					.f {
						margin-left: 24rpx;
						width: 112rpx;
						height: 48rpx;
						background: #3377FF;
						border-radius: 8rpx 8rpx 8rpx 8rpx;
						font-size: 24rpx;
						color: #FFFFFF;
					}
				}

				// .butgp {
				// 	margin-top: 30rpx;

				// 	.t_w {
				// 		width: 160rpx;
				// 		height: 68rpx;
				// 		border-radius: 8rpx 8rpx 8rpx 8rpx;
				// 		border: 2rpx solid #CCCED1;
				// 		font-size: 28rpx;
				// 		color: #666B75;
				// 	}

				// 	.t_w_h {
				// 		width: 160rpx;
				// 		height: 68rpx;
				// 		background: #3377FF;
				// 		border-radius: 8rpx 8rpx 8rpx 8rpx;
				// 		color: #ffffff;
				// 		margin-left: 24rpx;
				// 	}

				// 	.o {
				// 		width: 230rpx;
				// 		height: 100rpx;
				// 		background: #F7F7F7;
				// 		border-radius: 16rpx 16rpx 16rpx 16rpx;
				// 		font-size: 32rpx;
				// 		color: #333A47;
				// 	}

				// 	.t {
				// 		margin-left: 24rpx;
				// 		width: 384rpx;
				// 		height: 100rpx;
				// 		background: #3377FF;
				// 		box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
				// 		border-radius: 16rpx 16rpx 16rpx 16rpx;
				// 		font-size: 32rpx;
				// 		color: #FFFFFF;
				// 	}

				// 	.t_jd {
				// 		width: 638rpx;
				// 		height: 100rpx;
				// 		background: #3377FF;
				// 		box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
				// 		border-radius: 16rpx 16rpx 16rpx 16rpx;
				// 		color: #FFFFFF;
				// 	}
				// }
			}

			.xcimg {
				margin: 24rpx auto 0 auto;
				width: 686rpx;
				// height: 272rpx;
				padding: 32rpx 24rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
				border-radius: 24rpx 24rpx 24rpx 24rpx;

				.title {
					font-size: 28rpx;
					color: #333A47;
				}

				.imglist {
					.zwt {
						margin-right: 20rpx;
						margin-top: 32rpx;
						width: 140rpx;
						height: 140rpx;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
					}
				}
			}

			.gzinfo {
				padding: 32rpx 24rpx;
				margin: 24rpx auto 0 auto;
				width: 686rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
				border-radius: 24rpx 24rpx 24rpx 24rpx;

				.t {
					margin-top: 32rpx;
				}

				.gz_o {
					font-size: 28rpx;
					color: #333A47;
				}

				.gz_t {
					font-size: 28rpx;
					color: #00091A;
				}
			}


		}
	}

	.butgp {
		margin: 24rpx auto 0 auto;

		.t_w {
			width: 160rpx;
			height: 68rpx;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			border: 2rpx solid #CCCED1;
			font-size: 28rpx;
			color: #666B75;
		}

		.t_w_h {
			width: 160rpx;
			height: 68rpx;
			background: #3377FF;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			color: #ffffff;
			margin-left: 24rpx;
		}

		.o {
			width: 230rpx;
			height: 100rpx;
			background: #F7F7F7;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			font-size: 32rpx;
			color: #333A47;
		}

		.t {
			margin-left: 24rpx;
			width: 384rpx;
			height: 100rpx;
			background: #3377FF;
			box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			font-size: 32rpx;
			color: #FFFFFF;
		}

		.t_jd {
			width: 638rpx;
			height: 100rpx;
			background: #3377FF;
			box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			color: #FFFFFF;
			margin: 0 auto;
		}
	}
</style>